<?php
namespace Common\Controller;
use Think\Controller;
class CommonController extends Controller {

	private static $log = '';

	public  $username = '';

    protected function _initialize() {

        // self::$log = new \Common\Util\Log('/'  . date('Y-m-d') . '.log');

        // self::$log->write('4545' , true , array('DD'=>'搭噶'), false);
        // 

    }
    public function login($username , $password){

    	if($username == 'admin' && $password == '888888'){

    		cookie('username' , $username);

    		session('username' , $username);

    		$this->username = $username;

    		return true;

    	}else{

    		return array('message'=>'用户名或者密码错误','status'=>0);

    	}

    }
    public function checkLogin(){

    	if(is_login()){

    		$this->username = session('username');

    		return true;

    	}else{

    		cookie('username' , null);

    		session('username' , null);

    		redirect(U('/index'));

    		return false;

    	}

    }

}